import request from "@/utils/http"

export const questions = (account) => {
    return request({
      url: `/forget/questions/${account}`,
      method: 'get'
    });
  }

/*
 * 验证安全问题答案
 * @param {string} account - 用户账号
 * @param {Array} answers - 用户提交的答案数组
 * @returns {Promise}
 */
export const answers = (account, answer) => {
  return request({
    url: `/forget/answers/${account}`, 
    method: 'post',
    data: answer 
  });
};

/**
 * 重置密码
 * @param {string} account - 用户账号
 * @param {string} newPassword - 新密码
 * @returns {Promise}
 */
export const Password = (account, newPassword) => {
  return request({
    url: `/forget/password/${account}`, 
    method: 'put', 
    data: {
      newPassword
    } 
  });
};